package top.byteio.common.core.enums.user;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用户状态
 *
 * @author lerryxia
 */
@Getter
@AllArgsConstructor
public enum UserStatus {
    /**
     * 正常
     */
    OK(0, "正常"),
    /**
     * 停用
     */
    DISABLE(1, "停用"),
    /**
     * 删除
     */
    DELETED(-1, "删除");

    private final int code;

    private final String info;

    public static UserStatus getStatus(int code) {
        for (UserStatus value : UserStatus.values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
